<?php
namespace app\models;

class UserLevel extends IModel {
    public $table = 't_user_level';

    public function getLevelInfoByExp($exp) {
        if(!is_numeric($exp)) {
            $exp = 0;
        }

        $sql = 'select level_name, minexp, maxexp, level_num from '
            . $this->table . ' where minexp <= '. $exp .' and maxexp >= ' . $exp;

        $data = $this->db->prepareSql($sql)->queryOne();

        return $data;
    }
}
